const form = document.querySelector(".card-body>form");
form.addEventListener("submit", async function (e) {
  e.preventDefault();
  const data = serialize(form, { hash: true, empty: true });
  const res = await axios({
    url: "/login",
    method: "post",
    data,
  });
  console.log(res);
  if (res.status === 200) {
    toast.innerHTML = res.data.message;
    setTimeout(() => (location.href = "./index.html"), 1000);
    localStorage.setItem("token", res.data.data.token);
  }
});
